﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.WindowsAzure.StorageClient;
 
namespace LCA.Community.DAL.Model
{
    /// <summary>
    /// This represent a vote form a user to a post.
    /// 
    /// RowKey = ID of the vote
    /// PartitionKey = ID of the post
    /// </summary>
    public class PostVote : BasicDataModel
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PostVote"/> class.
        /// </summary>
        public PostVote()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PostVote"/> class.
        /// </summary>
        /// <param name="postID">The post ID.</param>
        /// <param name="userID">The user ID.</param>
        public PostVote(string postID, string userID)
        {
            RowKey = Guid.NewGuid().ToString();
            PartitionKey = postID;
            User = userID;
        }

        /// <summary>
        /// Gets or sets the post.
        /// </summary>
        /// <value>The post.</value>
        public string Post
        {
            get
            {
                return PartitionKey;
            }
            set
            {
                PartitionKey = value;
            }
        }
        /// <summary>
        /// Gets or sets the user who voted.
        /// </summary>
        /// <value>The user who voted.</value>
        public string User { get; set; }
    }
}
